# include<vector>
#include <string>
#include<iostream>
using std::vector;
using std::cin;
using std::cout;
using std::endl;
using std::string;
void test1()
{
    vector<int> test_a = {12,32,32,4,43,44,534,54};
    vector<int> test_a_2(test_a);
    vector<double> test_d{123.32,32.21,32.3};
    vector<string> test_s(10,"#");
    vector<vector<string>> test_ss;
    for(int i=0;i<test_a.size();i++)
    cout<<test_a[i]<<endl;
    auto b=test_a.begin(),e=test_a.end();

}
void test2()
{
    string s("some string");
    for(auto it=s.begin();it!=s.end();it++)
    {
        // auto it = s.begin();
        *it = toupper(*it);
        // it++;
    }
    cout<<s<<endl;
}
void test3_search()
{
    double sought(8.0);
    vector<double> test;
    // auto beg1=test.begin();
    for (double i=0;i<1000;i++)
    {

        test.push_back(i);
        // cout<<*beg1<<endl;

        // beg1++;
    }
    auto beg(test.begin()),end(test.end());
    auto mid(test.begin()+(end-beg)/2);
    int n=0;
    while (mid!=end && *mid!=sought)
    {
        n++;
        if(sought<*mid)
        {
            end=mid;
        }
        else
            beg=mid+1;
        mid =beg+(end-beg)/2;
        cout<<"第"<<n<<"次查找"<<" mid="<<*mid<<endl;
    }
    
}
int main()
{   
    // test1();
    // test2();
    test3_search();
    return 0;

}